package cn.sinjet.utils;

import java.lang.Thread.UncaughtExceptionHandler;

import android.content.Context;
import android.util.Log;

public class CrashHandler implements UncaughtExceptionHandler{
    private static CrashHandler instance = null;
    public synchronized static CrashHandler getInstance(){
    	if(instance == null)
    		instance = new CrashHandler();
    	return instance;
    }
    
    public void init(Context context){
    	Thread.setDefaultUncaughtExceptionHandler(this);
    }
    
    
	@Override
	public void uncaughtException(Thread thread, Throwable throwable) {
		// TODO Auto-generated method stub
		Log.i("crash", "uncauhtException thread:"+thread+" name:"+thread.getName()
		+" id:"+thread.getId()+" exception:"+throwable);
	}

}
